<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>
		var book = {
			_year: 2004,
			edition: 1
		};

		Object.defineProperty(book, 'year', {
			// get: function () {
			// 	return this._year + 1;
			// },
			// set: function (newValue) {
			// 	if (newValue > 2004) {
			// 		this._year = newValue;
			// 		this.edition += newValue - 2004;
			// 	}
			// }
		});

		alert(book.year); // 2005

		book.year = 2010;
		alert(book.year); // 2011
		alert(book.edition); // 2
	</script>
</body>
</html>
